package com.xiawu;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test7 {
    public static void main(String[] args) {
//        实现步骤：
//        1，生成 54 张牌放入到集合中
//        2，洗牌
//        3，定义三个集合代表三个人，按照顺序发牌并把最后三张作为底牌
        // 1, 生成54张不同的牌
        List<String> list = new ArrayList<>();
        String color[]= {"♥","♠","♦","♣"};
        String number[]={"2","3","4","5","6","7","8","9","10","J","Q","K","A"};
        for(String c : color){
            for(String n : number){
                list.add(c+n);
            }
        }
        list.add("大王");
        list.add("小王");

        System.out.println(list);
        // 2， 洗牌
        Collections.shuffle(list);
        System.out.println(list);
        // 3,发牌
        List<String> lbw = new ArrayList<>();
        List<String> tzh = new ArrayList<>();
        List<String> wc = new ArrayList<>();
        List<String> dp = new ArrayList<>();

        for(int i=0;i<list.size();i++){
            if(i>=51){
                dp.add(list.get(i));
            }else if(i%3==0){
                lbw.add(list.get(i));
            }else if(i%3==1){
                tzh.add(list.get(i));
            }else if(i%3==2){
                wc.add(list.get(i));
            }
        }

        System.out.println("李博文："+ lbw);
        System.out.println("涂朝辉："+ tzh);
        System.out.println("王川："+ wc);
        System.out.println("底牌："+ dp);


    }
}
